package com.hhit.bigscreenbackmanage.controller.jsgl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.common.Response;
import com.hhit.bigscreenbackmanage.service.jsgl.TJsglSwcgyyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/jsgl/swcgyy")
public class SwcgyyController {

    private Logger log = LoggerFactory.getLogger(SwcgyyController.class);

    @Autowired
    TJsglSwcgyyService tJsglSwcgyyService;

    /**
     * 查询 三维成果交付统计
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getSwcgjfCount")
    public Response getSwcgjfCount(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Integer> result = tJsglSwcgyyService.querySwcgjfCount(jsonObject);
            return Response.createResponseBySuccess("查询三维成果交付统计成功",result);
        }catch (Exception e){
            log.error("查询三维成果交付统计失败: " + e.getMessage());
            e.printStackTrace();
            return Response.createResponseByError("查询三维成果交付统计失败");
        }
    }

    /**
     * 查询 三维设计应用详情
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getSwsjyyList")
    public Response getSwsjyyList(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Object> result = tJsglSwcgyyService.querySwsjyyList(jsonObject);
            return Response.createResponseBySuccess("查询三维设计应用详情成功",result);
        }catch (Exception e){
            log.error("查询三维设计应用详情失败: " + e.getMessage());
            e.printStackTrace();
            return Response.createResponseByError("查询三维设计应用详情失败");
        }
    }


    /**
     * 删除 三维设计应用记录
     * @param jsonObject
     * @return
     */
    @RequestMapping("/deleteSwsjyyRecord")
    public Response deleteSwsjyyRecord(@RequestBody JSONObject jsonObject){
        try{
            tJsglSwcgyyService.deleteSwsjyyRecord(jsonObject);
            return Response.createResponseBySuccess("删除三维设计应用记录成功");
        }catch (Exception e){
            e.printStackTrace();
            return Response.createResponseByError("删除三维设计应用记录失败: "+e.getMessage());
        }
    }
}
